<layout name='Layout/layout_popup' />
	<div class="title panel panel-default">
		<div class="panel-body">
			<h3 class="col-md-12">请选择父节点</h3>
		</div>
	</div>	
	<div class="operate panel panel-default">	<div class="panel-body">
		<div class="pull-left">
			<a  onclick="save();" class="btn btn-default">确定</a>
		</div>
		<div class="pull-right">
			<a  onclick="myclose();" class="btn btn-default">关闭</a>
		</div>
	</div>
	<div class="popup_tree_menu">
		<ul class="tree_menu">
			<li>
				<a node="0"><i class="icon"></i>
					<span>根节点</span>
				</a>
				{$menu}
			</li>
		</ul>
	</div>
</div></div>
<input type="hidden" name="val" id="val">
<input type="hidden" name="name" id="name">
<script type="text/javascript">
	function save() {
		if ($("#name").val().length > 0) {
			$("#node_name", parent.document).val($("#name").val());
			$("#pid", parent.document).val($("#val").val());
		} else {
			alert("请选择节点");
		}
		myclose();
	}

	$(document).ready(function() {
		parent_node=$(".sub_left_menu ul.tree_menu a.active",parent.document).attr("node");
		$("ul.tree_menu a[node='"+parent_node+"']").addClass("disabled");		
		$(".popup_tree_menu a:not('.disabled')").click(function() {
			$("#val").val($(this).attr("node"));
			$("#name").val($(this).children("span").text());
			$(".tree_menu a.active").removeClass("active");			
			$(this).addClass("active");
		})
	}); 
</script>